//package com.jingzhi.huimiao.base;
//
//import java.io.File;
//
//import org.apache.http.HttpStatus;
//import org.apache.http.client.HttpClient;
//
//public class TestSend {
//
//    public void upload(String localFile){  
//        File file = new File(localFile);  
//        PostMethod filePost = new PostMethod(URL_STR);  
//        HttpClient client = new HttpClient();  
//          
//        try {  
//            // 通过以下方法可以模拟页面参数提交  
//            filePost.setParameter("userName", 11);  
//            filePost.setParameter("passwd", passwd);  
//  
//            Part[] parts = { new FilePart(file.getName(), file) };  
//            filePost.setRequestEntity(new MultipartRequestEntity(parts, filePost.getParams()));  
//              
//            ((Object) ((HttpClient) client.getConnectionManager()).getParams()).setConnectionTimeout(5000);  
//              
//            int status = client.executeMethod(filePost);  
//            if (status == HttpStatus.SC_OK) {  
//                System.out.println("上传成功");  
//            } else {  
//                System.out.println("上传失败");  
//            }  
//        } catch (Exception ex) {  
//            ex.printStackTrace();  
//        } finally {  
//            filePost.releaseConnection();  
//        }  
//}  
//}
